'use strict';

const conn = require('../../../libs/Conn');

module.exports = async function (params) {
    let querySql='';
    if(params.group_id==='all'){
        querySql += `SELECT * FROM user_file uf INNER JOIN user_group ug ON uf.group_id = ug.group_id AND ug.delete_sign = 1 WHERE uf.delete_sign = 1 AND uf.group_id != 1`;
    }else{
        querySql += `SELECT * FROM user_file uf INNER JOIN user_group ug ON uf.group_id = ug.group_id AND ug.delete_sign = 1 WHERE uf.delete_sign = 1 AND uf.group_id != 1 AND uf.group_id = '${params.group_id}' `;
    }
    let rec = await conn(querySql);
    return {success: true, data: rec};

};